home *** CD-ROM | disk | FTP | other *** search
- /*
- * Demo of using clip2gif with the CFM PPC
- *
- * This program grabs a bit of screen and saves it in a GIF file
- *
- * To compile it, create a new PPC project with CW7 (other versions and compilers
- * might also work, but haven't been tested), include example.c, LoadClip2Gif.c
- * and the standard MacOS libraries, and build it. clip2gif should be in the same disk.
- *
- * Caution: This program calls a low-level debugger if it gets an error. Remove DebugStr
- * if you don't have one to avoid having to restart. Neither clip2gif nor the
- * CFM glue stuff call the debugger.
- *
- * Copyright 1995, Yves Piguet. All rights reserved.
- */
-
- #include "LoadClip2Gif.h"
-
- static void InitToolbox()
- {
- InitGraf((Ptr)&qd.thePort);
- InitFonts();
- InitWindows();
- InitMenus();
- TEInit();
- InitDialogs(0L);
- InitCursor();
- }
-
- void main(void)
- {
- Rect r;
- PicHandle thePic;
- OSErr err;
- StandardFileReply fileReply;
-
- InitToolbox();
-
- if (LoadClip2Gif() != noErr)
- {
- DebugStr("\pCannot load clip2gif");
- ExitToShell();
- }
-
- StandardPutFile("\pSave screen bit as", "\pscreen.gif", &fileReply);
- if (fileReply.sfGood)
- {
- SetRect(&r, 0, 0, 200, 160);
- err = GetScreen(&r, &thePic);
- if (err != noErr)
- DebugStr("\pGetScreen error.");
- else
- {
- err = ConvertPictToGIFFile(thePic, &fileReply.sfFile,
- 1, transparencyNo, 8, colorPaletteSystem);
- if (err != noErr)
- DebugStr("\pConvertPictToGifFile error.");
- }
- }
- }
-